package com.zjht.gmcc.servlet.pdt;

import java.io.PrintWriter;
import java.sql.PreparedStatement;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import com.zjht.gmcc.bean.BaseServlet;
import com.zjht.gmcc.bean.util.MyJDBC;

public class ProviderDelete extends BaseServlet {
	private static final long serialVersionUID = 1L;

	public boolean process(HttpServletRequest request, HttpServletResponse response,
			HttpSession session, PrintWriter out, MyJDBC myJDBC,  String menu)
			throws Exception {
		String providertypeid = request.getParameter("providertypeid");
		int i_flag=0;
		StringBuilder sql = new StringBuilder();
		sql.append ("delete providertype where providertypeid=?");
		PreparedStatement ps = myJDBC.prepareStatement(sql);
		ps.setString(1, providertypeid);
		i_flag=ps.executeUpdate();
		ps.close();
		ps = null;
		
		
		String url = "provider.jsp";
		String act = "供应商分类删除";
		if (i_flag > 0) {
			alert(out, act + "成功", url);
		} else {
			errAlert(request, out, menu, act + "失败");
		}
		return i_flag > 0;
	}
}
